package com.china.joinproject;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.EditText;
import android.widget.TextView;


public class LoginActivity extends Activity {
	public final static String EXTRA_NICK = "nick";
	

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		this.requestWindowFeature(Window.FEATURE_NO_TITLE);
		this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
				WindowManager.LayoutParams.FLAG_FULLSCREEN);
		setContentView(R.layout.login);
		TextView registerScreen = (TextView) findViewById(R.id.register_link);
		 
        // Listening to register new account link
        registerScreen.setOnClickListener(new View.OnClickListener() {
 
            public void onClick(View v) {
                // Switching to Register screen
                Intent i = new Intent(getApplicationContext(), RegisterActivity.class);
                startActivity(i);
            }
        });
	
	}

	public void switchToRegister(View v) {
		Intent i = new Intent(this, RegisterActivity.class);
		startActivity(i);
	}
	
	public void login(View v){
		Intent i = new Intent(this, MyProfileActivity.class);
		EditText editText = (EditText) findViewById(R.id.logText);
	    String nickname = editText.getText().toString();
	    i.putExtra(EXTRA_NICK, nickname);

		startActivity(i);
		
	}

}
